<?php
/**
 * $filename
 *
 * @version            $id
 * @createtime        2020/5/13
 * @updatetime        ${time}
 * @author          bluarry
 * @copyright        Copyright @ bluarry
 */

class QQData
{
    public $id=0;
    public $qq="";
    public $qqgroup="";
    public $ad="";
    public $dtime="";


    /**
     * 构造函数
     *
     * @return void
     */
    public function __construct() {

    }


    static public function add($qqnum, $groupnum, $kicktime,$ad){
        if(empty($qqnum)){throw new MyException('qq号不能为空', 101);}
        if(empty($groupnum)){throw new MyException('群号不能为空', 102);}
        if(empty($kicktime)){throw new MyException('时间不能为空', 103);}

        $rs=Table_qqdata::add($qqnum, $groupnum, $kicktime,$ad);
        if($rs > 0){
            //记录管理员日志log表
            $msg = '成功添加记录';
            return action_msg($msg, 1);
        }else{
            throw new MyException('操作失败', 106);
        }


    }
    static public function alldata($page_index,$page_size){
        if(empty($page_index)){throw new MyException('页面index不能为空', 101);}
        if(empty($page_size)){throw new MyException('页面大小不能为空', 101);}

        $rs=Table_qqdata::alldata($page_index,$page_size);
        if(!empty($rs)){
            $r = array(
                'code' => 0,
                'count'=>count($rs),
                'data'  => $rs
            );
            return json_encode_cn($r);
        }else{
            throw new MyException('操作失败', 106);
        }
    }

    static public  function deletebyid($id){
        if(empty($id)){return 0;}
        return Table_qqdata::delte($id);
    }
    static public function filtdata($page_index,$page_size,$param){

        $rs=Table_qqdata::filtdata($page_index,$page_size,$param);

        $r = array(
            'code' => 0,
            'count'=>count($rs),
            'data'  => $rs
        );
        return json_encode_cn($r);
    }

}


?>